package com.ruoyi.crm.crawling.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.crm.crawling.domain.CrmCrawling;
import com.ruoyi.crm.crawling.mapper.CrmCrawlingMapper;
import com.ruoyi.crm.crawling.service.ICrmCrawlingService;

/**
 * 数据抓取Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-08-31
 */
@Service
public class CrmCrawlingServiceImpl implements ICrmCrawlingService 
{
    @Autowired
    private CrmCrawlingMapper crmCrawlingMapper;

    /**
     * 查询数据抓取
     * 
     * @param id 数据抓取ID
     * @return 数据抓取
     */
    @Override
    public CrmCrawling selectCrmCrawlingById(Long id)
    {
        return crmCrawlingMapper.selectCrmCrawlingById(id);
    }

    /**
     * 查询数据抓取列表
     * 
     * @param crmCrawling 数据抓取
     * @return 数据抓取
     */
    @Override
    public List<CrmCrawling> selectCrmCrawlingList(CrmCrawling crmCrawling)
    {
        return crmCrawlingMapper.selectCrmCrawlingList(crmCrawling);
    }

    /**
     * 新增数据抓取
     * 
     * @param crmCrawling 数据抓取
     * @return 结果
     */
    @Override
    public int insertCrmCrawling(CrmCrawling crmCrawling)
    {
        crmCrawling.setCreateTime(new Date());
        crmCrawling.setUpdateTime(DateUtils.getNowDate());
//        crmCrawling.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
        return crmCrawlingMapper.insertCrmCrawling(crmCrawling);
    }

    /**
     * 修改数据抓取
     * 
     * @param crmCrawling 数据抓取
     * @return 结果
     */
    @Override
    public int updateCrmCrawling(CrmCrawling crmCrawling)
    {
        crmCrawling.setUpdateTime(new Date());
//        crmCrawling.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
        return crmCrawlingMapper.updateCrmCrawling(crmCrawling);
    }

    /**
     * 批量删除数据抓取
     * 
     * @param ids 需要删除的数据抓取ID
     * @return 结果
     */
    @Override
    public int deleteCrmCrawlingByIds(Long[] ids)
    {
        return crmCrawlingMapper.deleteCrmCrawlingByIds(ids);
    }

    /**
     * 删除数据抓取信息
     * 
     * @param id 数据抓取ID
     * @return 结果
     */
    @Override
    public int deleteCrmCrawlingById(Long id)
    {
        return crmCrawlingMapper.deleteCrmCrawlingById(id);
    }
}
